import java.util.Random;
import java.util.Scanner;

public class Test2 {

    /*
    * 顺序结构
    * 分支结构 if switch
    * if else
    * switch（） case
    * 循环结构 for while  do while
    *
    * break 让循环提前结束 执行到break就会让循环结束
    * continue 结束本次循环
    *
    *
    * */


    public static void main(String[] args) {
       Scanner scanner = new Scanner(System.in);

       Random random = new Random();//通过时间戳来生成
        Random random2 = new Random(6161315);//伪随机 每次得到的都是同一个数
       int randNum = random.nextInt(101);//[0~101) 左闭右开int
       int count = 3;
       while(count != 0) {
           System.out.println("请输入你要猜的数字：");
           int num = scanner.nextInt();
           if(num == randNum) {
               System.out.println("恭喜你猜对了！");
               break;
           }else if(num < randNum) {
               System.out.println("猜小了！");
           }else {
               System.out.println("猜大了！");
           }
           count--;
       }

    }

    //随机数
    public static void main10(String[] args) {
        Random random = new Random();//通过Random实例化一个对象
        int a = random.nextInt(100);
        int b = (int)(Math.random()*100);//通过Math.random()来获取一个0~1之间得double类型的数
        System.out.println(b);
        int c = (int)System.currentTimeMillis();//获取当前时间毫秒数，相当于时间戳 long类型
        System.out.println(c%100);


    }
    public static void main9(String[] args) {
        Scanner sc = new Scanner(System.in);//实例化对象
        String str = sc.nextLine();//读入一行数据
        String str2 = sc.next();//读取元素遇到空格就结束
        int age = sc.nextInt();//读取一个整数
        float age2 = sc.nextFloat();

    }


    public static void main8(String[] args) {

        int i = 1;
        while(i++ <= 100) {
            if(i % 3 !=0 || i % 5 !=0) {
                continue;
            }
            System.out.print(i + " ");
        }
    }


    //阶乘
    public static void main6(String[] args) {


        int sum = 0;
        for (int i = 1; i <= 5 ; i++) {
            int ret = 1;
            for (int j = 1; j <= i ; j++) {
                ret *= j;
            }
            sum +=ret;
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt();
        int i = 1;
        int ret = 1;
        while(i<=m) {
            ret *= i;
            i++;
        }
        System.out.println(ret);
    }
    public static void main4(String[] args) {
        int i = 1;
        int sum = 0;
        while(i <= 100) {
            sum += i;
            i += 2;
        }
        System.out.println(sum);
        int j = 0;
        int add = 0;
        while(j <= 100) {
            add += j;
            j += 2;
        }
        System.out.println(add);
    }
    public static void main3(String[] args) {
        String a = "hello";//可以是字符串 枚举也可以
        /*
        * 括号里面只能是byte char short int String常量串 枚举类型 不能是long类型
        *
        * */
        switch(a) {
            case "hello":
                System.out.println("hello");
                break;
            case "asd":
                System.out.println("2");
                break;
            default:
                System.out.println("输入错误");
                break;
        }
    }
    public static void main2(String[] args) {
        Scanner  scanner = new Scanner(System.in);
        int n = scanner.nextInt();//读入一个整数
    }
}
